/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --light-text: #7f8c8d;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #ecf0f1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body, html {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f0f0;
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

/* 容器布局 */
.container {
    max-width: none;
    width: 100vw;
    min-height: 100vh;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1976d2;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    color: #1976d2;
    font-weight: 300;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 270px;
    z-index: 100;
    height: 100vh;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: var(--shadow);
    background: var(--card-bg);
    padding: 25px 20px 25px 20px;
}

.sidebar h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.sidebar-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 10px 15px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 用户信息 */
.user-info {
    margin-bottom: 25px;
}

.user-info label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.current-user {
    background: var(--bg-color);
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin-bottom: 15px;
}

.current-user strong {
    display: block;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.user-role {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light-text);
}

.status-dot.online {
    background: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.user-info input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.user-info input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.user-actions {
    margin-bottom: 25px;
}

.logout-btn {
    background: var(--accent-color) !important;
    color: white !important;
    border-color: var(--accent-color) !important;
}

.logout-btn:hover {
    background: #c0392b !important;
    border-color: #c0392b !important;
}

/* 问题类型指示器 */
.question-types {
    margin-bottom: 25px;
}

.question-types h4 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.type-indicator {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-color);
    color: var(--light-text);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.type-tag.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 聊天区域 */
.chat-area {
    margin-left: 270px;
    flex: 1 1 0;
    min-width: 0;
    max-width: calc(100vw - 270px);
    height: 100vh;
    display: flex;
    flex-direction: column;
    /* animation: fadeInRight 0.8s ease; */
}

/* 聊天头部 */
.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.chat-header h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.chat-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* 消息列表 */
.messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 16px;
    padding-left: 20px;
    padding-right: 20px;
}

.message {
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease;
}

.message.user {
    text-align: right;
    background: none !important;
    box-shadow: none !important;
    color: #222;
}

.message.assistant {
    text-align: left;
}

.message-content {
    background: #fff !important;
    color: var(--text-color);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    font-size: 1rem;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
    margin-bottom: 6px;
}

.message.user .message-content {
    background: #f5f6fa !important;
    color: #222 !important;
    border-bottom-right-radius: 5px;
}

.message.assistant .message-content {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-top: 5px;
    opacity: 0.7;
    border: none;
    background: none;
    box-shadow: none;
}

/* 输入区域 */
.input-area {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
    z-index: 10;
    padding: 12px 20px 8px 20px;
}

.input-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-container textarea {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    min-height: 50px;
    max-height: 120px;
    transition: var(--transition);
}

.input-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.send-btn {
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.send-btn:disabled {
    background: var(--light-text);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--light-text);
    font-style: italic;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.status-indicator.error {
    border-left-color: var(--accent-color);
    background: #fdf2f2;
}

.status-indicator.success {
    border-left-color: var(--secondary-color);
    background: #f0f9ff;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 200px;
        padding: 15px 8px 15px 8px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .chat-area {
        margin-left: 0;
    }
}

/* 动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动条样式 */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--light-text);
}

/* 代码块样式 */
.code-block {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #2d3748;
    color: white;
}

.language-tag {
    font-size: 0.9rem;
    font-weight: 500;
}

.copy-btn {
    background: #4a5568;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #718096;
}

.code-block pre {
    margin: 0;
    padding: 15px;
    background: #2d3748;
    color: #e2e8f0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    max-width: 100%;
    word-break: break-all;
    white-space: pre-wrap;
}

.code-block code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.inline-code {
    background: #f7fafc;
    color: #e53e3e;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
}

/* 图表容器 */
.mermaid-container {
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    max-width: 100%;
}

.mermaid-header {
    padding: 10px 15px;
    background: #f7fafc;
    border-bottom: 1px solid var(--border-color);
}

.diagram-type {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
}

.mermaid-content {
    padding: 20px;
    text-align: center;
    overflow-x: auto;
}

.mermaid {
    display: inline-block;
    max-width: 100%;
}

.mermaid-error {
    color: #e53e3e;
    padding: 10px;
    background: #fed7d7;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--text-color);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 300;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background 0.2s;
}
.sidebar-toggle:hover {
    background: var(--secondary-color);
}
@media (max-width: 900px) {
    .sidebar-toggle {
        display: block;
    }
}

/* 表格样式 */
.enhanced-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
}

.enhanced-table th,
.enhanced-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    word-wrap: break-word;
    max-width: 200px;
}

.enhanced-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.enhanced-table tr:hover {
    background: #f8f9fa;
}

/* 消息内容样式增强 */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 25px 0 15px 0;
    color: var(--text-color);
    font-weight: 600;
}

.message-content h1 {
    font-size: 2rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 8px;
    margin-top: 0;
    position: relative;
}

.message-content h1::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 50px;
    height: 3px;
    background: var(--secondary-color);
}

.message-content h2 {
    font-size: 1.6rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
    margin-top: 30px;
    position: relative;
    padding-left: 15px;
}

.message-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

.message-content h3 {
    font-size: 1.4rem;
    margin-top: 25px;
    color: var(--primary-color);
    border-left: 3px solid var(--secondary-color);
    padding-left: 12px;
}

.message-content p {
    margin: 15px 0;
    line-height: 1.7;
    color: #4a5568;
}

.message-content ul,
.message-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.message-content li {
    margin: 8px 0;
    line-height: 1.6;
    color: #4a5568;
}

/* 层次化列表样式 */
.message-content ul li {
    position: relative;
    padding-left: 5px;
}

.message-content ul li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -15px;
}

/* 去除对ul li的所有特殊渲染，恢复为原生li小圆点 */
.message-content ul li,
.message-content ul li::before {
    all: unset;
    display: list-item;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
    padding: 0;
}

/* 去除对消息内容中有序列表li的特殊样式，恢复原生数字 */
.message-content ol li,
.message-content ol li::before {
    all: unset;
    display: list-item;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
    padding: 0;
}

.message-content strong {
    color: var(--primary-color);
    font-weight: 700;
    background: linear-gradient(120deg, rgba(52, 152, 219, 0.1) 0%, rgba(52, 152, 219, 0.1) 100%);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-color);
    transition: all 0.3s ease;
}

.message-content a:hover {
    color: var(--secondary-color);
    border-bottom: 1px solid var(--secondary-color);
    background: rgba(46, 204, 113, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

/* 层次化内容容器 */
.message-content > div {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.5);
    border-left: 4px solid var(--primary-color);
}

/* 层次化内容容器样式 */
.content-section {
    margin: 25px 0;
    padding: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.1);
    transition: all 0.3s ease;
}

.content-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.main-section {
    border-left: 6px solid var(--primary-color);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.sub-section {
    border-left: 4px solid var(--secondary-color);
    margin-left: 20px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.section-title {
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 1.8rem !important;
    color: var(--primary-color) !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sub-section .section-title {
    font-size: 1.5rem !important;
    color: var(--secondary-color) !important;
}

.section-subtitle {
    margin: 20px 0 15px 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 1.3rem !important;
    color: #2c3e50 !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #ecf0f1 !important;
    padding-bottom: 8px !important;
}

/* 层次化间距 */
.content-section > p:first-child {
    margin-top: 0;
}

.content-section > p:last-child {
    margin-bottom: 0;
}

/* 图标样式 */
.message-content h1::after,
.message-content h2::after {
    content: attr(data-icon);
    margin-left: 10px;
    font-size: 0.8em;
    opacity: 0.7;
} 

/* 系统回复内容统一样式 */
.system-section {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    margin: 24px 0;
    padding: 18px 22px 18px 22px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.system-section-title {
    font-size: 1.15em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.system-section-title i {
    color: var(--primary-color);
    font-size: 1.1em;
}
.system-section-list {
    margin-left: 22px;
    margin-bottom: 0;
}
.system-section-list li {
    margin-bottom: 8px;
    line-height: 1.7;
    font-size: 1em;
    color: var(--text-color);
} 

/* Mermaid关系图容器自适应更大，始终居中且最大化显示 */
.mermaid-container, .mermaid {
    width: 100vw !important;
    min-height: 70vh !important;
    max-width: none !important;
    overflow: auto !important;
    background: #fff;
    margin: 0 auto 24px auto;
    display: flex !important;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}
.mermaid svg {
    width: 90vw !important;
    height: 70vh !important;
    max-width: none !important;
    display: block;
    margin: 0 auto;
} 